package com.study.array;

import java.util.Arrays;

/**
 * @author ytj
 * @date 2021/12/29
 */
public class Method10 {
    public static void main(String[] args) {
        String[] s={"H","a","n","n","a","h"};
        reverseString(s);
        Arrays.stream(s).forEach(System.out::println);
    }

    public static void reverseString(String[] s) {
        int length=s.length/2+s.length%2;
        for(int i=0;i<s.length;i++) {
            if(length<=i){
                return;
            }
            String temp=s[i];
            s[i]=s[s.length-1-i];
            s[s.length-1-i]=temp;
        }
    }
}
